package com.colin.aiyi.dao.ImpxUtils;

import com.colin.aiyi.app.Constant;
import com.colin.aiyi.entity.BaseRequest;
import com.colin.aiyi.entity.response.YiJuAndYiShuoResponse;

import org.xutils.http.RequestParams;

/**
 * Created by hl on 2017/6/9.
 */

public class ImpDiscourseList extends AbsServicexUtils {
    @Override
    public void onSuccess(String result) {
        super.onSuccess(result);
        YiJuAndYiShuoResponse loginResponse=gson.fromJson(result,YiJuAndYiShuoResponse.class);
        if (callback==null)
        {
            loginResponse.setMsgType(msgType);
            sendMsgToView(loginResponse);
        }else {
            callback.onSuccess(loginResponse);
        }
    }

    @Override
    public <V> void getObject(V v) {
        super.getObject(v);
        BaseRequest request= (BaseRequest) v;
        if (request.getPageSize().equals("1"))
        {
            msgType=1;
        }
        RequestParams params=new RequestParams(Constant.DISCOURSE_list);
        params.addBodyParameter("pageSize",request.getPageSize());
        params.addBodyParameter("pageNum",request.getPageNum()+"");
        sendToServer(params);
    }
}
